<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ref 揭秘</title>
</head>
<body>
<div id="app">
    <div>{{numRef}}</div>
    <div>{{strRef}}</div>
    <div>{{arrRef}}</div>


    <div v-text="numRef"></div>
</div>
<script type="module">
    import {createApp, ref} from "../../js/vue.esm-browser.js";

    const app = createApp({
        setup() {
            let numRef = ref(123)
            let strRef = ref("abcdefg")
            let arrRef = ref([1, 2, 3, 4, 5])

            console.log(numRef);
            console.log(strRef);
            console.log(arrRef);


            // 通过 .value 进行响应式变量获取/修改值
            // numRef = numRef + "xyz"
            console.log(numRef.value + "xyz");
            numRef.value = numRef.value + "xyz"
            numRef.value = numRef.value + "abc"

            return {
                numRef,
                strRef,
                arrRef,
            }

        }
    })

    app.mount("#app")
</script>
</body>
</html>